<?xml version="1.0" encoding="windows-1255" ?>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
	<script type="text/javascript" language="javascript" src="validation.js">
	</script>
	<title>Code Sharing start page</title>
</head>
<body>
<fieldset>
	<legend align="center">Sign in</legend>
	<form method="post" action="loginValidate.jsp" onsubmit="return validateUser(this)">
		<table>
			<tr>
				<td>Email: </td>
				<td><input name="email" type="text" size="30" maxlength="128" /></td>
				<td class="required"><font color="red">*</font></td>
			</tr>
			<tr>
				<td>Password: </td>
				<td><input name="password" type="password" size="30" maxlength="14" /></td>
				<td class="required"><font color="red">*</font></td>
			</tr>
		</table>
				<% String valid = request.getParameter("valid");
			if (valid != null) {
				 if (valid.equals("false")) { %>
					<p>Wrong parameters, please check your user and password and login again.</p>
			<% } if (valid.equals("logout")){
					session.invalidate(); %>
					<p>You were successfully logged out.</p>				
			<% } if (valid.equals("unsigned")){ %>
					<p>You must first sign in to access this page.</p>				
			<% }
			}%>	
	<input type="submit" value="Sign in" />
	</form>
</fieldset>
<button onclick="showCreateAccount()">Create account</button>

<div id="hiddenForm" style="visibility: hidden;">
	<form method="post" action="../createUser" onsubmit="return createUser(this)">
		<fieldset><legend align="center">User information</legend>
			<table>
				<tr>
					<td>Email: </td>
					<td><input name="cemail" type="text" size="15" maxlength="128" class="fill" /></td>
					<td class="required"><font color="red">*</font></td>
				</tr>
				<tr>
					<td>Password: </td>
					<td><input name="cpassword" type="password" size="15" maxlength="14" /></td>
					<td class="required"><font color="red">*</font></td>
				</tr>
				<tr>
					<td>Re-enter Password: </td>
					<td><input name="rePassword" type="password" size="15" maxlength="14" /></td>
					<td class="required"><font color="red">*</font></td>
				</tr>
				<tr>
					<td>Administrator account: </td>
					<td>
						<select name="isAdmin" onchange="changeIsAdmin(this.form)">
							<option value="no">No</option>
							<option value="yes">Yes</option>
						</select>
						<input name="adminPassword" type="password" size="15" maxlength="14" id="adPass" style="visibility: hidden;" />
						<font color="red">*</font>
					</td>
				</tr>
			</table>
			<p>fields marked with <font color="red">*</font> are required</p>
		</fieldset>
		<fieldset><legend align="center">Personal information</legend>
			<table>
				<tr>
					<td>First name: </td>
					<td><input name="firstName" type="text" size="15" maxlength="14" /></td>
				</tr>
				<tr>
					<td>Last name: </td>
					<td><input name="lastName" type="text" size="15" maxlength="14" /></td>
				</tr>
			</table>
		</fieldset>
		<input type="submit" name="create" value="send details" />
		<input type="reset" value="clear form" />
	</form>
</div>

<div id="test" />
</body>
</html>